package com.health.dao;

import com.health.utils.ConnectionUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;

public class AttributeDao {

    public void insertData(int userId, int attributeId, String examineDate, String attributeText) {
        Connection connection = ConnectionUtil.getConnection();
        PreparedStatement preparedStatement = null;
        String sql = "insert into users_attribute values(?,?,?,?)";
        try {
            preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setInt(1, userId);
            preparedStatement.setInt(2, attributeId);
            preparedStatement.setString(3, examineDate);
            preparedStatement.setString(4, attributeText);
            preparedStatement.executeUpdate();


        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("SQL错误！");

        }

    }
}
